package com.yuan.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuan.blog.entity.CommentEntity;
import com.yuan.blog.mapper.CommentMapper;
import com.yuan.blog.service.ICommentService;
import com.yuan.blog.vo.CommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

/**
 * @program: com.yuan.blog
 * @description:
 * @author: yuan_boss
 * @create: 2022-12-05 21:38
 **/
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper,CommentEntity> implements ICommentService {


    @Autowired
    private CommentMapper mapper;


    @Override
    public List<CommentVo> commentListByInvitataionId(Integer id) throws SQLException {
        return mapper.commentListByInvitataionId(id);
    }

    @Override
    public boolean save(CommentEntity commentEntity){
        commentEntity.setCreateTime(new Date());
        commentEntity.setStatus(1);
        return mapper.insert(commentEntity) > 0;
    }
}
